home *** CD-ROM | disk | FTP | other *** search
- --Common Level Start Code
- G.Create( "MenuData/HudCog.xml" );
- G.Create( "Data/GameCamera.xml" );
- G.Create( "Data/CursorCog.xml" );
-
- MainLevel = G.Create( "Data/Levels/Campaign3/Campaign3.xml" );
- MainLevel.CreateLevel();
-
-
- G.SetInvSpeed( 20 );
- G.PlayMusic();
- HUD.EnterLevel();
- G.SetGameState( InLevel );
- G.SetPoints( 100 );
-
- gameStartTime = 10000000;
-
-
- HUD.Message( "VictoryCondition" , "SetText", "Survive 3 minutes!" );
- HUD.Message( "LossCondition" , "SetText", "If the Tower is destroyed you lose" );
-
-
- function LevelExitDesc()
- if ( GameState == QuitLevel )then
- G.ActiveBackGround( 2 );
- return "YOU QUIT!";
- elseif( GameState == Victory )then
- G.ActiveBackGround( 1 );
- return "YOU WON!";
- elseif( GameState == Defeat )then
- G.ActiveBackGround( 2 );
- return "YOU LOST!";
- end
- end
-
- function TraitorScript()
-
- LargeTextPopup( "Level 3:\n Special Delivery", Color(1,1,1,1) )
-
- G.DeactivateTrapDrop()
- G.DisableTrapAll()
- G.EnableTrap("wall");
- G.EnableTrap("laser");
- G.EnableTrap("spring");
- DisableTraitor()
- GameWait(.5)
- EnableTraitor()
- Traitor.SetGuiPosition( "TraitorWindow" , Vector3(0.6, -0.5, 1) );
-
- TraitorTalk("*Yawn* Hey, how're you? I slept great last night, that couch is real comfy!")
- GameWait(6)
- TraitorTalk("How did that thing with the other Invaders go?")
- GameWait(4)
- TraitorTalk("You're still here, so I guess that means you won. Good for you!")
- GameWait(5)
- TraitorTalk("... and, good for me too, hehe.")
- GameWait(3)
-
- --explosion
- GameWait(1)
- TraitorTalk("What was that?!")
- GameWait(1)
- --pan camera to kamikaze running into a wall
- TraitorTalk("Oh no, they must be really mad now!")
- GameWait(3)
- TraitorTalk("They're sending in the demolitionists to try and tear down our defenses.")
- GameWait(6)
- TraitorTalk("Lets get this place into fighting shape!");
- GameWait(3)
-
- -- drop springs
- GameWait(3)
-
- TraitorTalk("Those Spring Traps alone wont be enough.")
- GameWait(4)
- TraitorTalk("These guys will probably just run right by 'em.")
- GameWait(5)
- TraitorTalk("Oh, wait a minute! Here we go, try this...")
- GameWait(3)
-
- -- drop fans
- GameWait(3)
-
- TraitorTalk("These will help push all those hot-heads into the Spring Traps.")
- GameWait(6)
- TraitorTalk("Here, you better put some more down.")
- GameWait(3)
-
- G.EnableTrap("fan")
- -- explosion
- GameWait(1)
-
- TraitorTalk("Yikes! Let me know when its over!")
- GameWait(3)
- DisableTraitor()
- end
-
- function TraitorScript_InGame1()
- EnableTraitor();
- TraitorTalk("Boy those Kamikazes are fast!")
- GameWait(3)
- TraitorTalk("Be sure you get rid of them before they get to close to the tower.");
- GameWait(6)
- TraitorTalk("They can do some serious damage if they hit!");
- GameWait(5)
- DisableTraitor();
- end
-
- function TraitorScript_InGame2()
- EnableTraitor();
- TraitorTalk("Those Bombers may look slow, but they pack a mighty wallop.")
- GameWait(5)
- TraitorTalk("They've got a countdown timer, and when it hits zero, they blow up!");
- GameWait(6)
- TraitorTalk("Almost makes you feel sorry for them, doesn't it.");
- GameWait(5)
- DisableTraitor();
- end
-
-
- local ingames = {};
-
- function LevelVictory()
- local tower = G.GetCogName("Tower");
-
- if( not tower.IsValid() ) then
- G.SetGameState( Defeat );
- end
-
- if( GameTime - gameStartTime >= 180 ) then
- G.SetGameState( Victory );
- end
-
- if( not( GameState == InLevel ) ) then
- dofile( "Scripts/GameOver.lua" ); -- The gameover script should do all exit functionality:
- GMain["LevelVictory"] = nil;
- end
-
- if(GameTime - gameStartTime > 15 and not (ingames[1] == 1)) then
- ingames[1] = 1;
- CreateCoroutine(TraitorScript_InGame1)
- end
-
- if(GameTime - gameStartTime > 38 and not (ingames[2] == 1)) then
- ingames[2] = 1;
- CreateCoroutine(TraitorScript_InGame2)
- end
- end
-
-
- storyroutine = coroutine.create(TraitorScript);
-
- function StoryMode()
- if( storyroutine ) then
- local con = coroutine.resume(storyroutine)
- if( con == false ) then
- gameStartTime = GameTime;
- storyroutine = nil;
- GMain["LevelVictory"] = nil;
- DisableTraitor()
- dofile( "Data/Levels/Campaign3/campaign3Spawners.lua" );
- GMain["LevelVictory"] = LevelVictory;
- end
- if( not( GameState == InLevel ) ) then
- dofile( "Scripts/GameOver.lua" ); -- The gameover script should do all exit functionality:
- GMain["LevelVictory"] = nil;
- end
- end
- end
-
- GMain["LevelVictory"] = StoryMode;
-